package struct.enums;

public enum CompareType {
    EQ("=="),
    NE("!="),
    GT(">"),
    GE(">="),
    LT("<"),
    LE("<="),
    IN("in");

    private final String symbol;

    private CompareType(String symbol) {
        this.symbol = symbol;
    }

    public String getSymbol() {
        return this.symbol;
    }

    public static CompareType fromString(String typeStr) {
        for (CompareType type : CompareType.values()) {
            if (type.name().equalsIgnoreCase(typeStr) || type.getSymbol().equalsIgnoreCase(typeStr)) {
                return type;
            }
        }
        throw new IllegalArgumentException("No constant with text " + typeStr + " found");
    }
}
